<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.sci99.ex.model.*"%>
<%@ page import="com.sci99.ex.service.*"%>
<%@ page import="com.sci99.ex.util.*"%>
<%@ page import="org.apache.log4j.Logger"%>
<%@ page import="org.apache.commons.lang3.math.NumberUtils"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%
	Logger log = Logger.getLogger(this.getClass());
    Long vid = NumberUtils.createLong(request.getParameter("v"));
    Long cid = NumberUtils.createLong(request.getParameter("c"));
    Employee user = UserUtil.getUser();
    Course c = CourseService.getCourseById(cid);
    Note n = NoteService.getNote(user.getId(),c.getId());
    String cnt = "";
    if(n != null) {
        cnt = n.getContent();
		request.setAttribute("note", n);
	}
	Map video = VideoUtil.getVideo(vid);
	//log.error(vid);
    //log.error(n);
	request.setAttribute("VideoUrl", video.get("VideoUrl"));
	request.setAttribute("Course", c);
	request.setAttribute("cnt", cnt);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>视频播放页</title>
    <script src="public/jquery-1.8.3.min.js"></script>
    <script src="ckeditor/ckeditor.js"></script>
    <link href="styles/base.css" rel="stylesheet" type="text/css" />
    <link href="styles/common.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type="text/javascript">
    function saveNote(){
        $.ajax({
            type: 'POST',
            url: 'opt',
            data: { 'act':'saveNote','course':note.course.value,'content':CKEDITOR.instances.editor1.getData() },
            success: function(data, textStatus, jqXHR){
                if(data.success){
                    alert('保存成功');
                    //location.reload();
                }else{
                    alert('保存失败');
                }
            },
            dataType:'json'
        });
    }
    function saveNoteFinal(){
    	 $.ajax({
             type: 'POST',
             url: 'opt',
             data: { 'act':'saveNoteFinal','course':note.course.value,'content':CKEDITOR.instances.editor1.getData() },
             success: function(data, textStatus, jqXHR){
                 if(data.success){
                     alert('保存成功');
                     //location.reload();
                 }else{
                     alert('保存失败');
                 }
             },
             dataType:'json'
         });
    }
</script>
</head>
<body>
    <form id="note">
    <div class="main_out">
        <div class="main_top">
            <a href=""></a> <span>人力资源培训服务热线：6091073 7071868</span>
        </div>
        <div class="clear"></div>
        <div class="nav">
            <ul class="nav_l">
                <li><a href="index.jsp">首&nbsp;&nbsp;页</a></li>
                <li><a href="manage.jsp">课程管理</a></li>
                <!--li><a href="search.jsp">课程搜索</a></li -->
                <!--li><a href="add.jsp">课程添加</a></li -->
                <!--li><a href="video.jsp">视频播放</a></li -->
                <!--li><a href="login.jsp">登录页</a></li -->
            </ul>
            <div class="nav_r">
                <a href="j_spring_security_logout">退出登录</a>
            </div>
        </div>
    </div>
    <div class="main">
      <div class="head3 mt">
        <span>当前位置：<a href="index.jsp">卓创网络学院</a> &gt;&gt; <a href="manage.jsp">课程管理</a> &gt;&gt; 视频播放</span>
      </div>
      <div class="content">
        <div class="vid_l">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="600" height="450">
          <param name="movie" value="http://svod.oa.sci99.com/flash/videoauto.swf?vcastr_file=/upvideo/${VideoUrl}&amp;IsAutoPlay=1" />
          <param name="quality" value="high" />
          <param name="allowFullScreen" value="true" />
          <param name="IsAutoPlay" value="1" />
          <embed src="http://svod.oa.sci99.com/flash/videoauto.swf?vcastr_file=/upvideo/${VideoUrl}&IsAutoPlay=1" 
            width="600" height="450" allowfullscreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" />
          </object>
          <div class="line"></div>
          <table cellspacing="0" class="tab_note">
            <tr>
              <th>笔记</th>
            </tr>
            <tr>
              <td><textarea cols="80" id="editor1" name="content" rows="10" class="areainput ckeditor">${cnt}</textarea></td>
            </tr>
            <tr>
              <td height="45"><input name="" type="button" class="buttontj" style="cursor:pointer;" onclick="saveNoteFinal()"/><input name="" type="button" class="buttonsave" style="cursor:pointer;" onclick="saveNote()"/></td>
            </tr>
          </table>
        </div>
        <div class="vid_r">
          <div class="head1">
            <span>课程信息</span>
          </div>
          <div class="content2 info1">
            <b>课程名称：</b><c:out value="${Course.name}" /><br/>
            <b>讲师：</b><c:out value="${Course.lecturer}" /><br/>
            <b>总课时：</b><c:out value="${Course.period}" /><br/>
            <b>当前课时：</b>&nbsp;<br/>
            <b>内容简介：</b><c:out value="${Course.description}" />
          </div>
          <div class="head1">
            <span>相关课程</span>
          </div>
          <div class="content2">
            <div class="info">
            <img src="/" />
            <span><b>课程名称：</b> 企业招聘通常遇到的难题与招聘渠道的开发</span>
            <div class="clear"></div>
            <b>讲师：</b>邵正江&nbsp;&nbsp;
            <b>总课时：</b>10&nbsp;&nbsp;
            <b>当前课时：</b>5<br/>
            <b>内容简介：</b>本课程为人力资源部新推出的教程，主要讲述了在大量的简历中更快的挑选出相对比较合适的一部简历本课程为人力资源部新推出的。
          </div>
          <div class="info">
            <img src="/" />
            <span><b>课程名称：</b> 企业招聘通常遇到的难题与招聘渠道的开发</span>
            <div class="clear"></div>
            <b>讲师：</b>邵正江&nbsp;&nbsp;
            <b>总课时：</b>10&nbsp;&nbsp;
            <b>当前课时：</b>5<br/>
            <b>内容简介：</b>本课程为人力资源部新推出的教程，主要讲述了在大量的简历中更快的挑选出相对比较合适的一部简历本课程为人力资源部新推出的。
          </div>
          </div>
        </div>
        <div class="clear"></div>
      </div>
    </div>
    <div class="foot_out mt">
      <div class="foot">Copyright &copy; 2004-2012 SCI99 Inc. All rights reserved.</div>
    </div>
    <input type="hidden" name="note" value="${note.id}" />
    <input type="hidden" name="course" value="${Course.id}" />
    <input type="hidden" name="chapter" value="${Course.id}" />
    </form>
</body>
</html>
